package com.tiecode.string.encoder;

import android.content.Intent;

import com.qiplat.api.component.page.setting.SettingPage;
import com.qiplat.api.component.widget.item.ISettingItemView;
import com.qiplat.api.framework.common.setting.SettingProvider;
import com.qiplat.api.plugin.setting.PluginSettingManager;
import com.qiplat.framework.BaseObject;
import com.qiplat.framework.annotation.Autowired;

public final class MySettingManager extends BaseObject implements PluginSettingManager {
    public final static String KEY_ENCODE_ENABLED = "STRING_ENCODE_ENABLED";
    public final static String KEY_ENCODE_LOG = "STRING_ENCODE_LOG";

    @Autowired
    private SettingProvider settingProvider;

    @Override
    public void create(SettingPage page) {
        this.settingProvider = getSettingProvider();
        ISettingItemView item = page.addSettingItem("加密配置");
        boolean encodeString = settingProvider.getBoolean(KEY_ENCODE_ENABLED, true);
        boolean logEnabled = settingProvider.getBoolean(KEY_ENCODE_LOG, true);
        item.addSwitchItem("字符串加密", "是否开启字符串加密", KEY_ENCODE_ENABLED,  encodeString);
        item.addSwitchItem("日志输出", "是否开启日志输出", KEY_ENCODE_LOG,  logEnabled);
    }

    @Override
    public void onActivityResult(int requestCode, int resultCode, Intent data) {

    }

    @Override
    public void exitSetting() {

    }
}
